package com.xy.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author xxy
 * @date 2022/1/7 16:50
 */
@Configuration
public class RedissonConfig {


    @Bean(destroyMethod = "shutdown")
    public RedissonClient redisson(){
        // 创建配置
        Config config = new Config();
        // 单机模式
        config.useSingleServer().setAddress("redis://localhost:6379");
        return Redisson.create(config);
    }

}
